package no.sachmuld.methodcombination.examples.reflection.combo.courier;

import java.lang.*;

/**
 *
 */
public class Main implements Runnable {

    @Override
    public void run() {

        Main.class.getClassLoader().setDefaultAssertionStatus(true);

        Courier[] couriers = {
                new Courier().with(new ExpressDelivery(), new LoggingBehaviour()),
                new Courier().with(new SlowDelivery())
        };

        for (Courier courier : couriers) {
            try {
                Delivery delivery = courier.deliver(new Package(1));
                System.out.println(delivery);
            } catch (AssertionError e) {
                System.out.println("Violates contract: " + e.getMessage());
            }

        }

    }

    public static void main(String... args) {

        new Main().run();

    }

}
